#ifndef LONGKEY_COMMON_SECURITY_HMAC_H__
#define LONGKEY_COMMON_SECURITY_HMAC_H__

#include "inttypes.h"
#include "hash-internal.h"

#ifdef __cplusplus
extern "C" {
#endif

	typedef struct HMAC_CTX {
		HASH_CTX hash;
		uint8_t opad[64];
	} HMAC_CTX;

	void HMAC_MD5_init(HMAC_CTX* ctx, const void* key, int len);
	void HMAC_SHA_init(HMAC_CTX* ctx, const void* key, int len);
	const uint8_t* HMAC_final(HMAC_CTX* ctx);

#define HMAC_update(ctx, data, len) HASH_update(&(ctx)->hash, data, len)
#define HMAC_size(ctx) HASH_size(&(ctx)->hash)

#ifdef __cplusplus
}
#endif

#endif  // LONGKEY_COMMON_SECURITY_HMAC_H__